//获取应用实例
const app = getApp();

Page({
  data: {
    goods:[],
    lo:'https://xiaochengxu.printeasy.top',
    'commodityList': [
      {
        'name': '（全新）墨仓式打印机 打纸不卡纸照片打印机',
        'author': 'A4 A3 A6',
        'cover': 'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=4019430855,285101650&fm=26&gp=0.jpg',
      },
      {
        'name': '激光式打印机 水印办公用品墨水一箱',
        'author': '红色 黑色 黄色',
        'cover': 'https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=3892982419,674067253&fm=26&gp=0.jpg',
      },
      {
        'name': '（全新）针式打印机 打纸不卡纸照片打印机',
        'author': 'A4 A3 A6',
        'cover': 'http://china.pr.img.coovee.net/picture/2014-6/18_17_27_56_015.jpg',
      },
    ],
    // 组件所需的参数
    nvabarData: {
      showCapsule: 1, //是否显示左上角图标   1表示显示    0表示不显示
      title: '办公用品', //导航栏 中间的标题
    },
    // 此页面 页面内容距最顶部的距离
    height: app.globalData.height * 2 + 20,
  },
  onLoad() {
    let url = app.globalData.URL+'goods/commodity/type/list?type=1';
    let data = {};
    let that = this;
    app.wxRequest('GET', url, data, (res) => {
      let goods = res.rows
      that.setData({
        goods:goods
      })
      console.log(goods)
    }, (err) => {
      console.log(err.errMsg)
    })
  },
  gopurchase_details:function(e){
    let that = this;
    let id = e.currentTarget.dataset.id;
    let typeid = 1;
    wx.navigateTo({
      url: '/modelA/pages/equipment_procurement/purchase_details/purchase_details?id='+id+'&typeid='+typeid,
      success: function(res) {},
      fail: function(res) {},
      complete: function(res) {},
    })
  }
  
})
